package com.ssy.lingxi.member.merchant.entity;

import com.ssy.lingxi.member.merchant.handler.converter.JpaJsonToStringListConverter;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 会员交易评价历史记录
 * @author 万宁
 * @version 2.0.0
 * @date 2020-07-16
 */
@Entity
@Table(schema = "public", name = "ms_mc_member_trade_comment_history", indexes = {@Index(name = "ms_mc_member_trade_comment_history_member_id_idx", columnList = "memberId"), @Index(name = "ms_mc_member_trade_comment_history_role_id_idx", columnList = "roleId"), @Index(name = "ms_mc_member_trade_comment_history_sub_member_id_idx", columnList = "subMemberId"), @Index(name = "ms_mc_member_trade_comment_history_sub_role_id_idx", columnList = "subRoleId"), @Index(name = "ms_mc_member_trade_comment_history_rel_type_idx", columnList = "relType"), @Index(name = "ms_mc_member_trade_comment_history_deal_time_idx", columnList = "dealTime"), @Index(name = "ms_mc_member_trade_comment_history_create_time_idx", columnList = "createTime")})
public class MemberTradeCommentHistoryDO implements Serializable {
    private static final long serialVersionUID = -1146516522206008266L;

    /**
     * 记录id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "member_trade_comment_history_seq")
    @SequenceGenerator(sequenceName = "ms_mc_member_trade_comment_history_seq", name = "member_trade_comment_history_seq", allocationSize = 1)
    private Long id;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime createTime;

    /**
     * 上下级关联类型，定义在MemberRelationTypeEnum中，0-上级会员是平台 1-上级会员不是平台
     */
    @Column(columnDefinition = "int")
    private Integer relType;

    /**
     * 上级会员Id（记录所属的会员Id）
     */
    @Column(columnDefinition = "int8")
    private Long memberId;

    /**
     * 上级角色Id
     */
    @Column(columnDefinition = "int8")
    private Long roleId;

    /**
     * 评论方（上级会员名称）
     */
    @Column(columnDefinition = "varchar(200)")
    private String memberName;

    /**
     * 下级会员Id
     */
    @Column(columnDefinition = "int8")
    private Long subMemberId;

    /**
     * 下级角色Id
     */
    @Column
    private Long subRoleId;

    /**
     * 被评论方（下级会员名称）
     */
    @Column(columnDefinition = "varchar(200)")
    private String subMemberName;

    /**
     * 评价星级（1-5）
     */
    @Column(columnDefinition = "int")
    private Integer star;

    /**
     * 评价内容
     */
    @Column(columnDefinition = "varchar(400)")
    private String comment;

    /**
     * 是否屏蔽 1-显示 2-隐藏
     */
    @Column
    private Integer status;

    /**
     * 评价类型 1-买方（采购会员） 2-卖方（供应会员）
     */
    @Column
    private Integer tradeType;

    /**
     * 订单id
     */
    @Column
    private Long orderId;

    /**
     * 订单编号
     */
    @Column(columnDefinition = "varchar(200)")
    private String orderNo;

    /**
     * 订单类型
     */
    @Column
    private Integer orderType;

    /**
     * 订单商品id
     */
    @Column
    private Long orderProductId;

    /**
     * 商城类型id
     */
    @Column
    private Long shopId;

    /**
     * 订单来源商城的类型
     */
    @Column
    private Integer shopType;

    /**
     * 订单来源商城的环境
     */
    @Column
    private Integer shopEnvironment;

    /**
     * 交易商品
     */
    @Column(columnDefinition = "varchar(400)")
    private String product;

    /**
     * 商品id
     */
    @Column
    private Long productId;

    /**
     * 商品skuID
     */
    @Column
    private Long skuId;

    /**
     * 商品品类
     */
    @Column(columnDefinition = "varchar(50)")
    private String category;

    /**
     * 商品品牌
     */
    @Column(columnDefinition = "varchar(50)")
    private String brand;

    /**
     * 报价商品规格
     */
    @Column(columnDefinition = "varchar(50)")
    private String spec;

    /**
     * 商品主图
     */
    @Column
    private String productImgUrl;

    /**
     * 交易时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime dealTime;

    /**
     * 交易数量
     */
    @Column
    private BigDecimal dealCount;

    /**
     * 计量单位
     */
    @Column
    private String unit;

    /**
     * 单价
     */
    @Column(columnDefinition = "numeric")
    private BigDecimal price;

    /**
     * 总价
     */
    @Column(columnDefinition = "numeric")
    private BigDecimal totalPrice;

    /**
     *  评价图片
     */
    @Convert(converter = JpaJsonToStringListConverter.class)
    @Column(columnDefinition = "jsonb")
    private List<String> pics;

    /**
     * 被评价方回复 0-否 1-是
     */
    @Column
    private Integer replyStatus;

    /**
     * 被评价方回复内容
     */
    @Column(columnDefinition = "varchar(400)")
    private String replyContent;

    /**
     * 被评价方回复时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime replyTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Integer getRelType() {
        return relType;
    }

    public void setRelType(Integer relType) {
        this.relType = relType;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getMemberName() {
        return memberName;
    }

    public void setMemberName(String memberName) {
        this.memberName = memberName;
    }

    public Long getSubMemberId() {
        return subMemberId;
    }

    public void setSubMemberId(Long subMemberId) {
        this.subMemberId = subMemberId;
    }

    public Long getSubRoleId() {
        return subRoleId;
    }

    public void setSubRoleId(Long subRoleId) {
        this.subRoleId = subRoleId;
    }

    public String getSubMemberName() {
        return subMemberName;
    }

    public void setSubMemberName(String subMemberName) {
        this.subMemberName = subMemberName;
    }

    public Integer getStar() {
        return star;
    }

    public void setStar(Integer star) {
        this.star = star;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getTradeType() {
        return tradeType;
    }

    public void setTradeType(Integer tradeType) {
        this.tradeType = tradeType;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Long getOrderProductId() {
        return orderProductId;
    }

    public void setOrderProductId(Long orderProductId) {
        this.orderProductId = orderProductId;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public Integer getShopType() {
        return shopType;
    }

    public void setShopType(Integer shopType) {
        this.shopType = shopType;
    }

    public Integer getShopEnvironment() {
        return shopEnvironment;
    }

    public void setShopEnvironment(Integer shopEnvironment) {
        this.shopEnvironment = shopEnvironment;
    }

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public String getProductImgUrl() {
        return productImgUrl;
    }

    public void setProductImgUrl(String productImgUrl) {
        this.productImgUrl = productImgUrl;
    }

    public LocalDateTime getDealTime() {
        return dealTime;
    }

    public void setDealTime(LocalDateTime dealTime) {
        this.dealTime = dealTime;
    }

    public BigDecimal getDealCount() {
        return dealCount;
    }

    public void setDealCount(BigDecimal dealCount) {
        this.dealCount = dealCount;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public List<String> getPics() {
        return pics;
    }

    public void setPics(List<String> pics) {
        this.pics = pics;
    }

    public Integer getReplyStatus() {
        return replyStatus;
    }

    public void setReplyStatus(Integer replyStatus) {
        this.replyStatus = replyStatus;
    }

    public String getReplyContent() {
        return replyContent;
    }

    public void setReplyContent(String replyContent) {
        this.replyContent = replyContent;
    }

    public LocalDateTime getReplyTime() {
        return replyTime;
    }

    public void setReplyTime(LocalDateTime replyTime) {
        this.replyTime = replyTime;
    }
}
